package com.edu.chapter09_kotlin.model

import java.util.Objects

class GameInfo {
    private var id = 0
    private var gameName: String? = null
    private var packageName: String? = null
    private var appId: String? = null
    var icon: String? = null
    var introduction: String? = null
    private var brief: String? = null
    private var versionName: String? = null
    private var apkUrl: String? = null
    private var tags: String? = null
    private var score = 0.0
    private var playNumFormat: String? = null
    private var createTime: String? = null
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || javaClass != other.javaClass) return false
        val gameInfo = other as GameInfo
        return id == gameInfo.id && gameInfo.score.compareTo(score) == 0 && gameName == gameInfo.gameName && packageName == gameInfo.packageName && appId == gameInfo.appId && icon == gameInfo.icon && introduction == gameInfo.introduction && brief == gameInfo.brief && versionName == gameInfo.versionName && apkUrl == gameInfo.apkUrl && tags == gameInfo.tags && playNumFormat == gameInfo.playNumFormat && createTime == gameInfo.createTime
    }

    override fun hashCode(): Int {
        return Objects.hash(
            id,
            gameName,
            packageName,
            appId,
            icon,
            introduction,
            brief,
            versionName,
            apkUrl,
            tags,
            score,
            playNumFormat,
            createTime
        )
    }

    override fun toString(): String {
        return "GameInfo{" +
                "id=" + id +
                ", gameName='" + gameName + '\'' +
                ", packageName='" + packageName + '\'' +
                ", appId='" + appId + '\'' +
                ", icon='" + icon + '\'' +
                ", introduction='" + introduction + '\'' +
                ", brief='" + brief + '\'' +
                ", versionName='" + versionName + '\'' +
                ", apkUrl='" + apkUrl + '\'' +
                ", tags='" + tags + '\'' +
                ", score=" + score +
                ", playNumFormat='" + playNumFormat + '\'' +
                ", createTime='" + createTime + '\'' +
                '}'
    }
}
